/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package collections.dao;

import collections.factory.ListasFactory;
import collections.mapeamento.TbLog;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author Pedro Reis
 */
public class RelatorioLogDAO extends ListasFactory {

    public List<TbLog> retornaListaPanelLog(Date dataInicio, Date dataFim, String[] tipoLog, boolean checkBox) {
        List<TbLog> listaTbLog = new ArrayList<TbLog>();

        for (Iterator<TbLog> it = listaLog.iterator(); it.hasNext();) {
            TbLog tbLog = it.next();
            if (checkBox == true) {
                for (int i = 0; i < tipoLog.length; i++) {
                    if (tbLog.getTpoLog().equals(tipoLog[i])) {
                        listaTbLog.add(tbLog);
                    }
                }
            } else {
                if (tbLog.getDtaLog().after(dataInicio) && tbLog.getDtaLog().before(dataFim)) {
                    for (int i = 0; i < tipoLog.length; i++) {
                        if (tbLog.getTpoLog().equals(tipoLog[i])) {
                            listaTbLog.add(tbLog);
                        }
                    }
                }
            }
        }
        return listaTbLog;
    }
}
